-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add OpenSearch #21 #31
Conversation
Thanks for the pull request, @cmltaWt0! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
Awesome, thanks @cmltaWt0! let us know when you want a review. |
6f80b98
to
7d08f5d
Compare
@bradenmacdonald PR is ready for review. Some concerns I want to emphasise:
|
@cmltaWt0 Awesome, thanks! I probably can't get to this until next week but I'll take a look then.
I don't think we need to support that? People should be using one or the other. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Braden's comment about not supporting both opensearch and elasticsearch at the same time.
Would it be possible to use a single endpoint for the cluster using the
clusterName
value? Seems like it's available in both the opensearch and elasticsearch charts. Setting that to a common value in our values.yaml for both opensearch.clusterName
and elasticsearch.clusterName
should do the trick I would think. Or is there any concern if we do that?
On a similar note, can we use a single helper class to interact with both APIs? The code in both elasticsearch.py
and opensearch.py
seems quite similar, so maybe instead we can use a single class that receives additional parameters besides namespace
(like the endpoint for example) and each command instantiates it accordingly.
I agree. Looks like the current simple implementation is enough. |
@MoisesGSalas Good idea, btw. |
Definitely! Thanks. |
@MoisesGSalas @bradenmacdonald I've added some sort of unification. Could we continue the review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cmltaWt0, while trying to deploy this in an EKS cluster I noticed a few errors at the start:
vm.max_map_count [65530] is too low, increase to at least [262144]
Seems like configuring that on opensearch is disabled by default while in the elasticsearch is enabled by default. Maybe we should enabled it in our chart defaults? I didn't manage to make it work in my first test so I copy pasted this, but it was probably an mistake on my part.
@@ -21,7 +21,7 @@ | |||
# The workaround is to manually add a list of hosts to be routed to the caddy | |||
# instance. | |||
"INGRESS_HOST_LIST": [], | |||
"ENABLE_SHARED_ELASTICSEARCH": False, | |||
"K8S_HARMONY_ENABLE_SHARED_HARMONY_SEARCH": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prefix (K8S_HARMONY_
) shouldn't be included here because we add the prefix to each key while loading the configs in the hook.
openedx-k8s-harmony/tutor-contrib-harmony-plugin/tutor_k8s_harmony_plugin/plugin.py
Lines 40 to 42 in d7fb4b4
hooks.Filters.CONFIG_DEFAULTS.add_items( | |
[(f"K8S_HARMONY_{key}", value) for key, value in config["defaults"].items()] | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
ELASTIC_SEARCH_CONFIG = [{ | ||
"use_ssl": True, | ||
"host": "elasticsearch-master.{{K8S_HARMONY_NAMESPACE}}.svc.cluster.local", | ||
"host": "harmony-search-cluster-master.{{K8S_HARMONY_NAMESPACE}}.svc.cluster.local", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service name that I got was actually harmony-search-cluster.{{K8S_HARMONY_NAMESPACE}}.svc.cluster.local
instead of harmony-search-cluster-master.{{K8S_HARMONY_NAMESPACE}}.svc.cluster.local
. After changing this I was able to index a course successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MoisesGSalas. I tested with these config successfully. Will re-test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed change after unification.
Fixed.
Hey @cmltaWt0, a friendly reminder to follow up on @MoisesGSalas's comments above. |
Thanks, @itsjeyd. I'm going to resolve the comments. |
5696010
to
5253c73
Compare
@MoisesGSalas it's a bit hardcoded here to be able to test everything else. And I'm going to come up with a final configuration for certificates. UPD: probably the issue is in cert generation template both for elasticsearch and opensearch:
UPD2:
Fixed for both ElasticSearch and OpenSearch. |
@cmltaWt0 Thanks for the updates! Are the changes ready for another round of review or will you be making further changes to the code? |
@itsjeyd PR is ready for the second review. |
No problem @cmltaWt0. @MoisesGSalas Could you please give this another look (or let us know when you think you'll have time for a second review pass)? |
{% if K8S_HARMONY_ENABLE_SHARED_HARMONY_SEARCH %} | ||
# This is needed otherwise the previously installed edx-search | ||
# package doesn't get replaced. Once the below branch is merged | ||
# upstream it will no longer be needed. | ||
RUN pip uninstall -y edx-search | ||
RUN pip install --upgrade git+https://github.com/open-craft/edx-search.git@keith/prefixed-index-names | ||
RUN pip install edx-search==3.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version of edx-search landed on Palm, same as the changes to forum. Maybe this is no longer necessary and we should bump the appVersion
to v16.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MoisesGSalas Updated and re-tested with Palm with any patching. Everything works pretty good.
@cmltaWt0, I think the issue with the reindex shouldn't be a blocker considering the --setup flag seems to be only used while using the devstack. I think the rest of the pr looks fine. |
@cmltaWt0, actually I've noticed an error while recreating the opensearch cluster and testing again. Whenever I try to refresh a course index I get a 403 error on the cms logs and the following error on the opensearch logs:
I don't know if I missed something. |
@MoisesGSalas Your logs says the Sample log with a prefixed index:
Could you show exactly how do you do the reindexing? |
@cmltaWt0 you are right, is weird that it isn't adding the prefix. I tried both, hitting the |
Could you please check whether you image uses open-craft original version or I changed the setting name here:
This is due the original work (open-craft/edx-search.git@keith/prefixed-index-names) uses ELASTICSEARCH_INDEX_PREFIX so our early work with shared elasticsearch was using the same naming. |
I've updated appVersion, removed any docker image patching and re-tested everything from scratch - recreated cluster and installed Palm release from a scratch too. I'm able to
I'm still unable to get
IMPORTANT: I've rebased the branch on top of latest |
@cmltaWt0, you are 100% right. I didn't even noticed the name changed. I tested again using a Palm image and everything seems to be working. I think we can go ahead with what we have here. |
Changes: - set the same cluster and service name - unify tutor plugin configuration variables
I've re-tested ElasticSearch deployment and pushed one missed setting for the service name (I tested opensearch but forgot to test elastic for any regression). Retested again for ElasticSearch and for OpenSearch - everything is great. I'm convinced we can merge it now. |
Thanks @cmltaWt0, this is wonderful. |
@cmltaWt0 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Thanks @felipemontoya 🚀 |
OpenSearch integration as a Shared resource.
Testing instructions
result:
result:
Implements #21
Issues
edx-search
library. This leads to AccessDenied response due to Index prefix separation.ex.